package pw.archipelag.loaderGame.panel.scores {
	import base.btn.BtnHit;
	import flash.display.Shape;
	import flash.display.Sprite;
	import base.btn.BtnHitEvent;
	import pw.archipelag.loaderGame.interfaceGame.skinsPanel.SkinScores;
	import base.math.MathExt;

	public class BarScroll extends BtnHit {
		
		private var bg: Shape;
		
		public function BarScroll(): void {
			this.createBg();
			super(this.createHit());
			this.addEventListener(BtnHitEvent.OVER, this.onOverHandler);
			this.addEventListener(BtnHitEvent.OUT, this.onOutHandler);
			this.dispatchEvent(new BtnHitEvent(BtnHitEvent.OUT));
		}
		
		private function createBg(): void {
			this.bg = new Shape();
			this.addChild(this.bg)
		}
		
		private function createHit(): Sprite {
			var hit: Sprite = new Sprite();
			hit.graphics.beginFill(0, 0);
			hit.graphics.drawRect(0, 0, 1, 1);
			hit.graphics.endFill();
			return hit;
		}
		
		private function onOverHandler(event: BtnHitEvent): void {
			//ConstantsMenuTools.addRemoveDropShadow(this, 0);
		}
		
		private function onOutHandler(event: BtnHitEvent): void {
			//ConstantsMenuTools.addRemoveDropShadow(this, 1);
		}
		
		internal function draw(skinScores: SkinScores): void {
			this.scaleX = this.scaleY = 1;
			this.bg.graphics.clear();
			this.bg.graphics.beginFill(skinScores.colorScrollBar, MathExt.extractChannel(skinScores.colorScrollBar));
			this.bg.graphics.drawRect(0, 0, skinScores.widthScrollBar, skinScores.heightScrollBar);
			this.bg.graphics.endFill();
			this.hit.width = skinScores.widthScrollBar;
			this.hit.height = skinScores.heightScrollBar;
		}
		
	}

}